package pro.shushi.pamirs.demo.api.model;

import pro.shushi.pamirs.demo.api.enumeration.OrderStatusEnum;
import pro.shushi.pamirs.meta.annotation.Field;
import pro.shushi.pamirs.meta.annotation.Model;
import pro.shushi.pamirs.meta.base.IdModel;
import pro.shushi.pamirs.meta.base.common.CodeModel;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;


@Model.model(Order.MODEL_MODEL)
@Model(displayName = "订单", labelFields = "code")
@Model.Code(sequence = "DATE_SEQ", prefix = "T", size = 6, initial = 10000, step = 3, format = "yyyyMMdd")
public class Order extends CodeModel {

    private static final long serialVersionUID = -5104390780952631397L;

    public static final String MODEL_MODEL = "demo.OrderNew";

    @Field.Date
    @Field(displayName = "预定时间")
    private Date bookingDate;


    @Field.Money(D = 2, min = "0.0")
    @Field(displayName = "公布总金额")
    private BigDecimal publicAmount;


    @Field.Money(D = 2, min = "0.0")
    @Field(displayName = "结算总金额")
    private BigDecimal amount;


    @Field.Enum
    @Field(displayName = "订单状态")
    private OrderStatusEnum status;


    @Field.String
    @Field(displayName = "取消原因")
    private String cancelReason;


    @Field.String
    @Field(displayName = "订单确认")
    private String confirmFlag;


    @Field.Date
    @Field(displayName = "订单确认时间")
    private Date confirmTime;

    // TODO:确认人是ID？
    @Field.Integer
    @Field(displayName = "订单确认人")
    private Long confirmUser;


    @Field.String
    @Field(displayName = "订单确认备注")
    private String confirmRemark;


    @Field.one2many
    @Field(displayName = "订单详情")
    @Field.Relation(relationFields = "id",referenceFields = "orderId")
    private List<OrderDetail> orderDetails;


    @Field.one2many
    @Field(displayName = "订单联系人")
    @Field.Relation(relationFields = "id",referenceFields = "orderId")
    private List<OrderContacts> orderContacts;

}
